Custom Hooks lets you share stateful logic, not the state itself. Each call to a Hook is completely independent from every other call to the same Hook.
The code inside your custom Hooks will re-run during every re-render of your component. This is why, like components, custom Hooks need to be pure. Think of custom Hooks’ code as part of your component’s body!
Because custom Hooks re-render with your component, they always receive the latest props and state.
A good custom Hook makes the calling code more declarative by constraining what it does.